package com.naiterui.ehp.ps.form.service;

import java.util.Map;

import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.multipart.MultipartFile;

import com.naiterui.ehp.bp.bo.form.DesignFormBO;
import com.naiterui.ehp.bp.support.exception.BusinessException;

public interface IDesignFormService {

    /**
     * 获取设计表单
     * 
     * @param formId
     * @return
     */
    DesignFormBO getDesignFormVO(String formId);

    /**
     * 获取表单设计和数据
     */
    DesignFormBO getDesignFormDataVO(String formId, @PathVariable String businessId) throws BusinessException;

    /**
     * 保存表单设计
     */
    String saveDesignForm(DesignFormBO designForm);

    /**
     * 复制表单设计
     * 
     * @param formId
     * @return
     */
    String copyDesignForm(String formId);

    /**
     * 保存表单数据
     */
    void saveData(String formId, String businessId, Map<String, Object> data) throws BusinessException;

    /**
     * 文件上传
     */
    String uploadFile(MultipartFile file) throws BusinessException;

    /**
     * 表单结构克隆（不动配置）
     *
     * @param sourceId
     * @param targetId
     *
     * @return
     */
    String cloneDesignForm(String sourceId, String targetId);

    /**
     * 缓存表单数据
     * 
     * @param businessId
     * @param formId
     * @param data
     * @throws BusinessException
     */
    void saveCacheFormData(String businessId, String formId, Map<String, Object> data) throws BusinessException;

    /**
     * 获取表单缓存数据
     * 
     * @param businessId
     * @param formId
     * @return
     * @throws BusinessException
     */
    Map<String, Object> getCacheFormData(String businessId, String formId) throws BusinessException;

}
